#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QApplication>
#include <QVBoxLayout>
#include <QMainWindow>
#include <QPushButton>
#include <QLabel>
#include <QListWidget>
#include <QHBoxLayout>
#include <QTreeWidget>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QUrl>
#include <QComboBox>
#include <QMap>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void quitSlot();
    void playSlot();
    void volumeSlot(int value);

    void setPosition(int);
    void positionChanged(qint64 value);
    void durationChanged(qint64 value);

    void playPrev();
    void playNext();

    void playTo(int);  // 歌单放歌
    void setPlayMode(int);

    void iconActivated(QSystemTrayIcon::ActivationReason);

private:
    int volumeMin = 0;
    int volumeMax = 50;
    int volumeStep = 1;

    QString path = "/home/gog/Desktop/song/"; // 音乐存放路径

    QAction *quitAction;
    QAction *prevPlayAction;
    QAction *playAction;
    QAction *pausePlayAction;
    QAction *nextPlayAction;
    QAction *increaseVolume;
    QAction *decreaseVolume;
    QAction *aboutAction;

    QWidget *widget;
    QMediaPlayer *player;
    QMediaPlaylist *playlist;

    QHBoxLayout *layout1;
    QHBoxLayout *layout2;
    QHBoxLayout *layout3;
    QHBoxLayout *layout4;
    QLabel *iconLabel;
    QPushButton *settingButton;
    QPushButton *minButton;
    QPushButton *maxButton;
    QPushButton *closeButton;
    QListWidget *songNameList;
    QListWidget *songWordList;
    QSlider *processSlider;
    QLabel *processLabel;
    QLabel *headIcon;
    QLabel *songName;
    QPushButton *prevButton;
    QPushButton *nextButton;
    QPushButton *playButton;
    QLabel *volumeLabel;
    QSlider *volumeSlider;
    //QPushButton *playModeButton;
    QComboBox  *playModeBox;

    QSystemTrayIcon *trayIcon;

    void initSongList();
    void createSystemTray();
};

#endif // MAINWINDOW_H
